<?php
/**
 * 获取医嘱history数据
 * @authors xiadx (xiadx@zpdchina.com)
 * @date    2017-03-08 10:04:02
 * @version $Id$
 */

class GetyizhuhistorydatajsonController extends Yaf_Controller_Abstract {

    public function indexAction()
    {
    	$request = $this->getRequest();
    	$user_department = $request->getPost('user_department', '');
    	if (empty($user_department)) {
    		Utility::apiJsonError(10000, '科室不能为空!');
    	}
    	$zhuyuan_id = $request->getPost('zhuyuan_id', '');
    	$modify_time = $request->getPost('modify_time', '');
    	$json_data_str = $request->getPost('data', '');
    	$compression_http_data = $request->getPost('compression_http_data', 'off');
    	// 解压缩数据
    	$json_data = json_decode(Utility::uncompress($json_data_str, $compression_http_data));

    	$yizhu_his_mod = new YizhuHistoryModel;
    	$his_data = $yizhu_his_mod->getYizhuHistoryDataCommon($user_department, $zhuyuan_id,$json_data, $modify_time);

    	$field_arr = $yizhu_his_mod->_field_arr;
    	$async_result['update_sql'] = Utility::formatToSqlStrExtends($his_data, 'yizhu_zhixing_history_lishi', 'update_sql', $field_arr);
        $async_result['error'] = 200;
        $async_result['msg'] = '';
    	Utility::apiJsonResultExtends($async_result);
    }
}
